import { getStockList, getProfileData } from '../_api/index.js'

export default {
  namespaced: true,
  
  state: {
    stockList: [],
    
    profileData: {}
  },
  
  mutations: {
    SET_STOCK_LIST (state, dataList) {
      state.stockList = dataList
    },
    
    SET_PROFILE_DATA (state, data) {
      state.profileData = data
    }
  },
  
  actions: {
    getStockListReq ({commit}) {
      getStockList()
        .then(res => {
          commit('SET_STOCK_LIST', res.data)
        })
        .catch()
    },
    
    getProfileDataReq({commit}) {
      getProfileData()
        .then(res => {
          commit('SET_PROFILE_DATA', res.data)
        })
        .catch()
    }
  }
}